package com.tongshu.naive.chat.socket.handler;

import com.tongshu.naive.chat.application.UIService;
import com.tongshu.naive.chat.socket.MyBizHandler;
import com.tongshu.naive.chat.ui.view.chat.IChatMethod;
import io.netty.channel.Channel;
import javafx.application.Platform;
import protocol.msg.MsgResponse;

public class MsgHandler extends MyBizHandler<MsgResponse> {
    public MsgHandler(UIService uiService) {
        super(uiService);
    }

    @Override
    public void channelRead(Channel channel, MsgResponse msg) {
        IChatMethod chatMethod = uiService.getiChatMethod();
        Platform.runLater(()->{
            chatMethod.addTalkMsgUserLeft(msg.getFriendId(), msg.getMsgText(), msg.getMsgType(), msg.getMsgDate(), true, false, true);
        });
    }
}
